﻿#Get-ExecutionPolicy
#Set-ExecutionPolicy RemoteSigned

#Get-Host
#Get-Host | Select-Object Version
#$Host | Select-Object Name
#$Host | Get-Member -MemberType Property

#1. Array
#$ip=ipconfig
#$ip
#$ip.Count
#$ip.GetType().FullName
#$ip -is [Array]
##$ip | Select-String "ip"

#$str="abc"
#$str.GetType().FullName

#2. Object
#$dir=(dir)[0]
#$dir.GetType().FullName
#$dir | Get-Member -MemberType Method
#$dir.Create

#3. static method
#$date=Get-Date
#$date
#$date.GetType().FullName
#[DateTime] | Get-Member -MemberType Method
#[DateTime]::IsLeapYear(2014)

# 4.New-Object
#[DateTime].GetConstructors() | foreach{$_.ToString()}

#$hello=New-Object string('a',10)
#$hello
#$hello.GetType().GetConstructors() | foreach{$_.ToString()}

# 5. Convert
#$hello="Hello"
#$helloArray=[Char[]]$hello
#$helloArray
#$helloInt=[int[]]$helloArray
#$helloInt

#6. Array
#$array=1,2,3
#$array
#$array -is [array]

#$array1=,1
#$array1
#$array1 -is [array]

#$emptyArray=@()
#$emptyArray
#$emptyArray -is [array]

#$array1=@("aa","bb","cc")
#$array1
#Write-Host "---------------"
#$array2=$array1
#$array1[1]="bbb"
#$array1
#Write-Host "---------------"
#$array2
#Write-Host "---------------"

## Clone
#$array3=$array1.Clone()
#$array3[2]="ccc"
#$array1

#7. function
#function Square([int]$num)
#{
#	return $num*$num
#}

#Square(10)
#$result=square 100
#$result

#8. return multiple value
#function CalculateSize($size)
#{
#	"$size G=($size*1024) M"
#	"$size G=($size*1024*1024) KB"
#}

#$result=CalculateSize 1
#$result

#9 Get-Command
#Get-Command Set-Alias | Select-Object ModuleName
#$command=Get-Command Set-Alias
#$command.GetType().FullName

#10. for
#function WriteNumber([int]$num)
#{
#	for($i=0;$i -le $num;$i++)
#	{
#		Write-Host $i
#	}
#}

#$result=WriteNumber 10
#$result

#11. read-host
#for($domain="";!($domain -like "www.*.*");$domain=Read-Host "Input domain")
#{
#	Write-Host -ForegroundColor "Green" "Please give a valid domain name."
#}



